<?php
/**
 * User: zwh
 * Date: 2016-2-25 16:27:54
 */
class Service extends Eloquent
{
    protected $table = "service";
    
    /**
     * @Author: dx
     * @DateTime:    2015-11-30 14:09:41
     * @param array $package_ids 包id
     * @Description: 查询人工费,根据包id
     */
    public static  function getServiceByPackIds($package_ids = array(), $place = 2){
        if(empty($package_ids) || empty($place)) return array();
        $service = ProductPackItem::leftjoin('service_product_item','product_pack_item.item_id','=','service_product_item.id')
        ->whereIn('product_pack_item.pack_id',$package_ids)
        ->where('service_product_item.status',1)
        ->where('product_pack_item.status',1)
        ->where('product_pack_item.type',2)
        ->where('service_product_item.place',$place)
        ->select(array('product_pack_item.pack_id','service_product_item.name','service_product_item.work_hours','service_product_item.price','service_product_item.type as s_type','product_pack_item.type','service_product_item.id','service_product_item.icon'))
        ->get()->toArray();
        return $service;
    }
    

}